<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
  list-style-image: url(../resources/blue-20.png);
}
.target {
  background-color: black;
  width: 100px;
  list-style-image: url(../resources/green-20.png);
}
.expected {
  background-color: green;
}
</style>
<body>
<template id="target-template">
  <ul>
    <li class="target"></li>
  </ul>
</template>
<script src="resources/interpolation-test.js"></script>
<script>
function assertCrossfadeInterpolation(options) {
  var fromComputed = options.fromComputed || options.from;
  assertInterpolation({
    property: 'list-style-image',
    from: options.from,
    to: options.to,
  }, [
    {at: -0.3, is: fromComputed},
    {at: 0, is: fromComputed},
    {at: 0.3, is: '-webkit-cross-fade(' + fromComputed + ', ' + options.to + ', 0.3)'},
    {at: 0.5, is: '-webkit-cross-fade(' + fromComputed + ', ' + options.to + ', 0.5)'},
    {at: 0.6, is: '-webkit-cross-fade(' + fromComputed + ', ' + options.to + ', 0.6)'},
    {at: 1, is: options.to},
    {at: 1.5, is: options.to},
  ]);
}

assertCrossfadeInterpolation({
  from: neutralKeyframe,
  fromComputed: 'url(../resources/green-20.png)',
  to: 'url(../resources/stripes-20.png)',
});

assertNoInterpolation({
  property: 'list-style-image',
  from: 'initial',
  to: 'url(../resources/stripes-20.png)',
});

assertCrossfadeInterpolation({
  from: 'inherit',
  fromComputed: 'url(../resources/blue-20.png)',
  to: 'url(../resources/stripes-20.png)',
});

assertCrossfadeInterpolation({
  from: 'unset',
  fromComputed: 'url(../resources/blue-20.png)',
  to: 'url(../resources/stripes-20.png)',
});

// Constant image
assertCrossfadeInterpolation({
  from: 'url(../resources/stripes-20.png)',
  to: 'url(../resources/stripes-20.png)',
});

// None to image
assertNoInterpolation({
  property: 'list-style-image',
  from: 'none',
  to: 'url(../resources/stripes-20.png)',
});

// Image to image
assertCrossfadeInterpolation({
  from: 'url(../resources/green-20.png)',
  to: 'url(../resources/stripes-20.png)',
});

// Image to gradient
assertCrossfadeInterpolation({
  from: 'url(../resources/green-20.png)',
  to: 'linear-gradient(45deg, blue, orange)',
});

// Gradient to gradient
assertCrossfadeInterpolation({
  from: 'linear-gradient(-45deg, red, yellow)',
  to: 'linear-gradient(45deg, blue, orange)',
});
</script>
</body>
